import requests
from fake_useragent import UserAgent
from lxml import etree

url="https://tuchong.com/1055775/12963729/"
headers={
    "User-Agent":UserAgent().chrome
}
response=requests.get(url,headers=headers)
e=etree.HTML(response.text)
img_urls=e.xpath('//article[@class="post-content"]/img/@src')

# print(img_urls)
for url in img_urls:
    response=requests.get(url,headers=headers)
    img_name=url[url.rfind('/')+1:]
    with open('img/'+img_name,'wb') as f:
        f.write(response.content)





